#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

int findPoisonedDuration(int* timeSeries, int timeSeriesSize, int duration);

int main()
{
	return 0;
}

int findPoisonedDuration(int* timeSeries, int timeSeriesSize, int duration)
{
	int res = 0, last = 0;
	for (int i = 0; i < timeSeriesSize; i++) {
		int curTime = timeSeries[i], past = curTime - last;
		if (past >= duration)
			res += duration;
		else
			res += past;
		last = curTime;
	}

	return res;
}
